<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.lagou.task.service.ClassService" %>
<%@ page import="com.lagou.task.entity.SysClass" %>
<%@ page import="java.util.List" %><%
    ClassService classService = new ClassService();
    List<SysClass> sysClasses = classService.showAllService();
%>
<!-- 编辑用户模态框 -->
<div class="modal fade" id="modifyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">编辑信息</h4>
            </div>
            <div class="modal-body">
                <!--定义表单-->
                <form class="form-horizontal" role="form" id="modifyForm" action="modify" method="post">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">学号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入8位学号" name="modifyId">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入姓名" name="modifyName">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">性别</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入性别" name="modifySex">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">出生日期</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入出生日期" name="modifyBirth">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">email</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入email" name="modifyEmail">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">班级</label>
                        <c:set var="classes" value="<%=sysClasses%>" />
                        <c:choose>
                            <c:when test="${classes != null}">
                                <div class="col-sm-10">
                                    <select class="form-control" name="modifyClassName">
                                        <c:forEach var="c" items="${classes}">
                                            <option>${c.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </c:when>
                            <c:when test="${classes == null}">
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" value="暂无班级" name="modifyClassName" disabled>
                                </div>
                            </c:when>
                        </c:choose>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请填写备注" name="modifyNote">
                        </div>
                    </div>
                    <!--定义按钮-->
                    <div class="modal-footer form-group">
                        <%--设置一个隐藏的input存储要修改学生的id--%>
                        <input type="hidden" name="modifyHiddenID" id="modifyID">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="submit" class="btn btn-primary" id="modify">修改</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>